<template>
    <el-form :props="opUnitInfo" label-width="96px" disabled>
        <el-card class="w-full mt-[10px]">
            <CardHead> 平台信息</CardHead>
            <el-row :gutter="20">
                <el-col :span="1"></el-col>
                <el-col :span="10">
                    <el-form-item label="机构编号" prop="code">
                        <el-input :value="opUnitInfo.code" placeholder="请输入机构编号" />
                    </el-form-item>
                </el-col>
                <el-col :span="2"></el-col>
                <el-col :span="6">
                    <el-form-item label="机构名称" prop="name">
                        <el-input :value="opUnitInfo.name" placeholder="请输入机构名称" />
                    </el-form-item>
                </el-col>
                <el-col :span="5"></el-col>
            </el-row>
            <el-row :gutter="20">
                <el-col :span="1"></el-col>
                <el-col :span="10">
                    <el-form-item label="负责人" prop="charger">
                        <el-input :value="opUnitInfo.charger" placeholder="请输入负责人" />
                    </el-form-item>
                </el-col>
                <el-col :span="2"></el-col>
                <el-col :span="6">
                    <el-form-item label="机构级别" prop="levelId">
                        <el-input :value="displayValue" placeholder="请输入机构级别" />
                    </el-form-item>
                </el-col>
                <el-col :span="5"></el-col>
            </el-row>
        </el-card>
    </el-form>
</template>

<script setup>
import CardHead from "./CardHead.vue";
import {getCategoryData } from "@/api/research/unit";

const cfg_category_jgjb = ref([]);

const props = defineProps({
  opType: {  
    type: Number,
    required: true,
    default: 0      // 默认值  0:add 1:edit 2:check 3:view
  },
  opUnitInfo: {  
    type: Object,
    required: false,
  }
}) 

const displayValue = computed(() => {
  const entry = cfg_category_jgjb.value.find(item => item.value === props.opUnitInfo.levelId);
  return entry ? entry.label : '';
});

onMounted(() => {
    getCategoryData(cfg_category_jgjb, {bizName:"机构级别"});
})
</script>

<style scoped lang="scss">
@import url("../index.scss");
</style>